<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>绑定函数-偏函数</title>
    </head>
    <body>
        <h1>绑定函数-偏函数</h1>
        <p>来源:<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/bind</a></p>
        <script>
            function list() {
              return Array.prototype.slice.call(arguments);
            }

            var list1 = list(1, 2, 3); // [1, 2, 3]

            // Create a function with a preset leading argument
            var leadingThirtysevenList = list.bind(undefined, 37);

            var list2 = leadingThirtysevenList(); // [37]
            var list3 = leadingThirtysevenList(1, 2, 3); // [37, 1, 2, 3]
            console.log('list1='+list1,'list2='+list2,'list3='+list3);
        </script>
    </body>
</html>